package kr.saeildamil.androidstudy.ch09;

import kr.saeildamil.androiddforstudy.R;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.View;

public class ChangeMenu extends Activity {
	boolean mBeginner = true;
	private static final String TAG = "LogTest";
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ch09_changemenu);
		Log.v(TAG, "onCreate");
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		super.onCreateOptionsMenu(menu);
		Log.v(TAG, "onCreateOptionMenu");
		MenuInflater inflater = getMenuInflater();
		if(mBeginner){
			Log.v(TAG, "mBeginner " + mBeginner + "초보자용");
			inflater.inflate(R.menu.beginner, menu);
		}else{
			Log.v(TAG, "mBeginner " + mBeginner + "전문가용");
			inflater.inflate(R.menu.professional, menu);
		}
		return true;
	}
	
	public void mOnClick(View v){
		Log.v(TAG, "mOnClick");
		if(v.getId()==R.id.ch09_changemenu_beginner_btn){
			this.mBeginner=true;
			invalidateOptionsMenu();
		}else{
			this.mBeginner=false;
			invalidateOptionsMenu();
		}
	}
}
